package com.yonyou.pmclouds.basecom.conf;

import lombok.Data;
import org.redisson.config.ReadMode;
import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "spring.redisson")
@Data
public class PMRedissonProperties {
    // 这个哨兵模式的配置
    private int idleConnectionTimeout = 10000;
    private int pingTimeout = 1000;
    private int connectTimeout = 10000;
    private int timeout = 3000;
    private int retryAttempts = 3;
    private int retryInterval = 1500;
    private int reconnectionTimeout = 3000;
    private int failedAttempts = 3;
    private String password = null;
    private int subscriptionsPerConnection = 5;
    private String clientName = null;
    private int slaveConnectionMinimumIdleSize = 10;
    private int slaveConnectionPoolSize = 64;
    private int masterConnectionMinimumIdleSize = 10;
    private int masterConnectionPoolSize = 64;
    private ReadMode readMode = ReadMode.MASTER_SLAVE;
    private String sentinelAddresses;
    private String masterName = "master";

    // 单机的配置， 使用阿里云时，使用该配置，主从由阿里云保证
    private String address;
    private int connectionPoolSize = 64;
    /**
     * Minimum idle subscription connection amount
     */
    private int subscriptionConnectionMinimumIdleSize = 1;
    /**
     * Redis subscription connection maximum pool size
     *
     */
    private int subscriptionConnectionPoolSize = 50;
    /**
     * Minimum idle Redis connection amount
     */
    private int connectionMinimumIdleSize = 10;
    /**
     * Should the server address be monitored for changes in DNS? Useful for
     * AWS ElastiCache where the client is pointed at the endpoint for a replication group
     * which is a DNS alias to the current master node.<br>
     * <em>NB: applications must ensure the JVM DNS cache TTL is low enough to support this.</em>
     * e.g., http://docs.aws.amazon.com/AWSSdkDocsJava/latest/DeveloperGuide/java-dg-jvm-ttl.html
     */
    private boolean dnsMonitoring = true;

    /**
     * Interval in milliseconds to check DNS
     */
    private long dnsMonitoringInterval = 5000;



    // 公用配置
    private int database = 0;
    private int threads = 0;
    private int nettyThreads = 0;
    private boolean useLinuxNativeEpoll = false;


}
